package com.gao.service.Impl;

import com.gao.Mapper.UserMapper;
import com.gao.pojo.User;
import com.gao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {
        return userMapper.selectAll();
    }
    @Override
    public void addUser(User user){
        this.userMapper.insert(user);
    }

    @Override
    public User findUserById(Long id) {
        return this.userMapper.selectByPrimaryKey(id);
    }

    @Override
    public void updateUser(User user) {
        this.userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public void delUserById(Long id) {
        this.userMapper.deleteByPrimaryKey(id);
    }
}
